Why does ASP.NET MVC 4 SimpleMembershipProvider keep creating aspnetdb.mdf?
Posted
When you create a new ASP.NET MVC 4 Internet Web Application it creates a nice template with authentication enabled with new SimpleMembershipProvider It contains InitializeSimpleMembershipAttribute
class which creates built-in Entity Framework Code First database and initializes Simple Membership:
using (var context = new UsersContext())
{
if (!context.Database.Exists())
{
// Create the SimpleMembership database without Entity Framework migration schema
((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
}
}
WebSecurity.InitializeDatabaseConnection( "DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);